﻿using Anke.SHManage.BLL;
using Anke.SHManage.MSSQLDAL;
using Anke.SHManage.Utility;
using Microsoft.Reporting.WebForms;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Anke.SHManage.Web.Reports
{
    public partial class PrintAmbulanceBasicInfoWebForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Data_Binding();
            }
        }

        private void Data_Binding()
        {
             
            //var    zcenterCode=$('#zcenterCode').combobox('getValue');
            //      var   zstationCode= $('#zstationCode').combobox('getValue');
            //      var   zPlateNumber= $('#zPlateNumber').textbox('getText');
            //    var  zCarNumber=$('#zCarNumber').textbox('getText');
            //    var InsuranceDateStart = $('#InsuranceDateStart').datebox('getValue') ? $('#InsuranceDateStart').datebox('getValue') : "1970-01-01";
            //    var  InsuranceDateEnd= $('#InsuranceDateEnd').datebox('getValue') ? $('#InsuranceDateEnd').datebox('getValue') : "2300-01-02";
            //    var  AnnualSurveyDateStart=$('#AnnualSurveyDateStart').datebox('getValue') ? $('#AnnualSurveyDateStart').datebox('getValue') : "1970-01-01";
            //    var  AnnualSurveyDateEnd=$('#AnnualSurveyDateEnd').datebox('getValue') ? $('#AnnualSurveyDateEnd').datebox('getValue') : "2300-01-02";
            //    var   isActive= $('#zisActive').combobox('getValue') ? $('#zisActive').combobox('getValue') : "";
            //    var  messgeIds= messageids ? messageids : ""

            string zcenterCode = Request.QueryString["zcenterCode"];
            string zstationCode = Request.QueryString["zstationCode"];
            string zPlateNumber = Request.QueryString["zPlateNumber"];
            string zCarNumber = Request.QueryString["zCarNumber"];
            DateTime InsuranceDateStart = Convert.ToDateTime(Request.QueryString["InsuranceDateStart"]);
            DateTime InsuranceDateEnd = Convert.ToDateTime(Request.QueryString["InsuranceDateEnd"]);
            DateTime AnnualSurveyDateStart = Convert.ToDateTime(Request.QueryString["AnnualSurveyDateStart"]);
            DateTime AnnualSurveyDateEnd = Convert.ToDateTime(Request.QueryString["AnnualSurveyDateEnd"]);
            string isActive = Request.QueryString["isActive"];

            string messgeIds = Request.QueryString["messgeIds"];

            E_StatisticsPermisson em = UserOperateContext.Current.getMaxPerForStatistics();
            string selfWorkCode = UserOperateContext.Current.Session_UsrInfo.WorkCode;
            string selfCenterID = UserOperateContext.Current.Session_UsrInfo.P_Department.DispatchSubCenterID;
            string selfStationID = UserOperateContext.Current.Session_UsrInfo.P_Department.DispatchSationID;



            this.ReportViewer1.LocalReport.DataSources.Clear();
            this.ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"~/Reports/PrintAmbulanceBasic.rdlc");
            C_AmbulanceDAL dal = new C_AmbulanceDAL();

            DataTable dt = dal.getAmbDatePrint(zcenterCode, zstationCode, zPlateNumber, zCarNumber, InsuranceDateStart, InsuranceDateEnd,
                AnnualSurveyDateStart, AnnualSurveyDateEnd, isActive, messgeIds, em, selfWorkCode, selfCenterID, selfStationID);
            this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt));

            this.ReportViewer1.LocalReport.Refresh();



            this.ReportViewer1.LocalReport.Refresh();

        }
    }
}